package com.geostar.constructionland.analyse.service.spatiaanalyst.impl;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.geostar.constructionland.analyse.entity.model.AnalyseModel;
import com.geostar.constructionland.analyse.service.spatiaanalyst.AbsJsonParamPostAnalyst;
import com.geostar.constructionland.analyse.service.spatiaanalyst.MineralAlyParamService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/***
 * @Author makoto_zhu
 * @Date 2021-03-12 11:17:13
 * @Description 矿管系统分析服务拓展查询参数
 **/
@Component
@Slf4j
public class CommonMineralAnalyse extends AbsJsonParamPostAnalyst {
    @Autowired
    ObjectMapper objectMapper;
    @Autowired
    private MineralAlyParamService mineralAlyParamService;

    @Override
    public String getQueryParam(AnalyseModel analyseModel) throws Exception {
        /**确定接口参数构造类型**/
        Map<String, Object> requestInfo = mineralAlyParamService.getCommonParam(analyseModel);
        String jsonParam = null;
        try {
            jsonParam = objectMapper.writeValueAsString(requestInfo);
            log.info("requestInfo:" + jsonParam);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return jsonParam;
    }
}
